﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class musicSwitch : MonoBehaviour
{
    private bool flag;
    public Sprite[] sets;

    public void VoiceSwitch()
    {
        if(!flag)
        {
            transform.GetComponent<Image>().sprite = sets[1];
            transform.GetComponent<AudioSource>().Pause();
            //transform.GetComponent<AudioSource>().enabled = false;
            flag = true;
        }
        else
        {
            transform.GetComponent<Image>().sprite = sets[0];
            transform.GetComponent<AudioSource>().Play();
            //transform.GetComponent<AudioSource>().enabled = true;
            flag = false;
        }
    }
}
